package com.bjb.vr.auth.controller;

import com.bjb.vr.auth.service.LoginService;
import com.bjb.vr.common.result.CommonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 登录认证列表
 *
 * @author hujingbo
 * @version 1.0.0
 * @Description 登录认证接口列表
 * @createTime 2022年03月04日 11:01
 * @desc 登录认证接口列表
 */
@Slf4j
@RestController
@RequestMapping("/api/auth/v1")
public class LoginController {

    @Autowired
    LoginService loginService;

    /**
     * 刷新token
     *
     * @param refreshTokenId
     * @return
     */
    @GetMapping("/refreshToken")
    public CommonResult refreshToken(@Valid @RequestParam String refreshTokenId) {
        CommonResult result = loginService.refreshToken(refreshTokenId);
        return result;
    }

    /**
     * 获取验证码
     *
     * @return
     */
    @RequestMapping("/captcha")
    public CommonResult getCaptcha() {
        CommonResult result = loginService.getCaptcha();
        return result;
    }
}
